/*
 * material.h
 *
 *  Created on: Jan 12, 2011
 *      Author: dima
 */

#ifndef MATERIAL_H_
#define MATERIAL_H_

#include "prerequisites.h"

#include "SDL/SDL_opengl.h"

#include "engine.h"



struct Material
{
	int type;
	GLuint program;

	void (*load)(Material*);
	void (*bind)(Material*);


	GLuint mvp_matrix_handle;
};

struct MaterialInstance
{
	Material* material;
	void* data;
};

struct MaterialData_Simple
{
	float defaultColor[4];
};
struct MaterialData_SimpleTextured
{
	float defaultColor[4];
	Texture defaultTexuture;
};

// utility functions
GLuint loadShader(GLenum type, const char* src);
GLuint createProgram(GLuint vertexShader, GLuint fragmentShader);

// binds the shader program
void bindMaterial(Material* mat);
void bindMaterialInstance(MaterialInstance* mat);


void materialBind_Simple(Material* mat);


#endif /* MATERIAL_H_ */
